#if !defined(_IMI_IMIMP4_FFMPEG_API__H_INCLUDED_)
#define _IMI_IMIMP4_FFMPEG_API__H_INCLUDED_

#ifdef WIN32
#ifdef IMIMP4_FFMPEG_ANDROID_EXPORTS
#define IMIMP4_FFMPEG_LIB __declspec(dllexport)
#else
#define IMIMP4_FFMPEG_LIB __declspec(dllimport)
#endif

#ifndef CALL_METHOD
#define CALL_METHOD	__stdcall  //__cdecl
#endif
#else
#define IMIMP4_FFMPEG_LIB
#define CALL_METHOD
#endif

typedef int IMIMp4FFmpegHandle;

extern "C"
{
    IMIMP4_FFMPEG_LIB int IMIMp4FFmpeg_Init();

	IMIMP4_FFMPEG_LIB int IMIMp4FFmpeg_Create_File(const char* path,
												   unsigned int container,
												   unsigned int video,
												   unsigned int audio,
												   unsigned int vfps,
												   unsigned int vwidth,
												   unsigned int vheight,
												   unsigned int achannel,
												   unsigned int asamplerate,
												   IMIMp4FFmpegHandle* pIMIhandle);

	IMIMP4_FFMPEG_LIB int IMIMp4FFmpeg_WriteVideoFrame(IMIMp4FFmpegHandle IMIhandle,
														 unsigned char* data,
														 unsigned int data_len,
														 unsigned int vtimestamp,
														 bool iskeyframe);

	IMIMP4_FFMPEG_LIB int IMIMp4FFmpeg_WriteAudioFrame(IMIMp4FFmpegHandle IMIhandle,
														 unsigned char* data,
														 unsigned int data_len,
														 unsigned int atimestamp);

	IMIMP4_FFMPEG_LIB int IMIMp4FFmpeg_CloseFileForCreate(IMIMp4FFmpegHandle IMIhandle);

	IMIMP4_FFMPEG_LIB int IMIMp4FFmpeg_Open_File(const char* path,
												 unsigned int* container,
												 unsigned int* video,
												 unsigned int* audio,
												 unsigned int* vfps,
												 unsigned int* vwidth,
												 unsigned int* vheight,
												 unsigned int* achannel,
												 unsigned int* asamplerate,
												 unsigned int* abitrate,
												 IMIMp4FFmpegHandle* pIMIhandle);

	IMIMP4_FFMPEG_LIB int IMIMp4FFmpeg_GetVideoFrame(IMIMp4FFmpegHandle IMIhandle,
													   unsigned char* data,
													   unsigned int* data_len,
													   unsigned int* timestamp,
													   bool* iskeyframe,
													   bool* isaudioframe);

	IMIMP4_FFMPEG_LIB int IMIMp4FFmpeg_CloseFileForOpen(IMIMp4FFmpegHandle IMIhandle);
}

#endif